home *** CD-ROM | disk | FTP | other *** search
- /*
- ** $VER: accountslib.c 1.3 (08.02.94)
- **
- ** accounts.library standard functions
- **
- ** © Copyright 1994 by Norbert Püschel
- ** All Rights Reserved
- */
-
- #include <proto/exec.h>
- #include <proto/dos.h>
-
- #include <dos/dostags.h>
-
- #include <debug.h>
-
- struct DosLibrary *DOSBase;
-
- volatile struct Process *guardian = 0;
-
- extern void guardian_func(void);
-
- BOOL __saveds __asm LIBLocalAlloc(register __d0 struct Library *Base)
-
- {
- if(guardian == 0) { /* restart guardian process */
- guardian = CreateNewProcTags(NP_Entry,guardian_func,
- NP_Name,"Accounts Daemon",
- NP_Priority,0,
- NP_WindowPtr,-1,
- TAG_DONE);
- if(guardian) {
- debug("Guardian started\n");
- if(DoPkt0(&(((struct Process *)guardian)->pr_MsgPort),0)) return(TRUE);
- debug("Guardian failed\n");
- }
- return(FALSE);
- }
- return(TRUE);
- }
-
- BOOL __saveds __asm LIBLocalFree(register __d0 struct Library *Base)
-
- {
- return(TRUE);
- }
-
- BOOL __saveds __asm LIBGlobalAlloc(register __d0 struct Library *Base)
-
- {
- DOSBase = (struct DosLibrary *)OpenLibrary("dos.library",37);
- if(DOSBase) {
- debug("dos.library opened\n");
- return(TRUE);
- }
- debug("dos.library could not be opened\n");
- return(FALSE);
- }
-
- BOOL __saveds __asm LIBGlobalFree(register __d0 struct Library *Base)
-
- {
- if(guardian) {
- debug("Trying to kill guardian ...\n");
- Signal((struct Task *)guardian,SIGBREAKF_CTRL_C);
- return(FALSE);
- }
-
- debug("Expunging accounts.library\n");
-
- CloseLibrary((struct Library *)DOSBase);
- return(TRUE);
- }
-